package com.action.rental;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.controller.Action;
import com.dao.BookDao;
import com.dao.RentalDao;
import com.domain.Book;
import com.domain.Rental;

public class RentalProAction implements Action{
	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		request.setCharacterEncoding("euc-kr");
		
		String book_name = request.getParameter("book_name");
		
		RentalDao dao = RentalDao.getInstance();
		Rental rental = dao.getRentalByCondition(book_name);
		
		BookDao bookDao = BookDao.getinstance();
		Book book = bookDao.getBookByName(book_name);
		
		request.setAttribute("book", book);
		request.setAttribute("rental", rental);
		
		return "/view/rental/rentalForm.jsp";
	}
}
